package com.psytech.commons.configuration.spring;

import java.io.File;

import org.apache.commons.configuration.ConfigurationException;
import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;

import com.psytech.commons.configuration.ConfigurationLoader;
import com.psytech.commons.configuration.ExtendedPropertiesConfiguration;

public class PlaceholderConfigurer extends PropertyPlaceholderConfigurer {

	public PlaceholderConfigurer() throws ConfigurationException {
		super();
		final ExtendedPropertiesConfiguration configuration = ConfigurationLoader.load();
		this.setProperties(configuration.getProperties());
	}

	public PlaceholderConfigurer(final String fileName) throws ConfigurationException {
		final ExtendedPropertiesConfiguration configuration = new ExtendedPropertiesConfiguration(new File(fileName));
		this.setProperties(configuration.getProperties());
	}

}
